package org.rslai.autotest.core.page.impl;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.rslai.autotest.core.page.AbstractHelper;
import org.rslai.autotest.core.page.Click;
import org.rslai.autotest.core.page.Conf;
import org.rslai.autotest.core.page.Wait;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Click处理方法
 * @author rslai
 */
public class ClickImpl extends AbstractHelper implements Click {

	@Autowired
	private Conf conf;

	@Autowired
	private Wait wait;

	@Override
	public void click(By by) {
		WebElement webElement = this.wait.waitForElement(by);
		webElement.click();

		this.sleep(this.conf.getDriverPlaybackSpeed()); // 设置回放速度
	}

	@Override
	public void click(WebElement element, By by) {
		WebElement webElement = this.wait.waitForElement(element, by);
		webElement.click();

		this.sleep(this.conf.getDriverPlaybackSpeed()); // 设置回放速度
	}

}
